package infomation.view 
{
	import ui.infomation.CityInfo1UI;
	import utils.T;
	import vo.CastleVO;
	import vo.GeneralVO;
	import vo.PlayerVO;
	
	/**
	 * ...
	 * @author WLDragon 2014-03-19
	 */
	public class CityInfo1 extends CityInfo1UI 
	{
		
		public function CityInfo1() 
		{
			super();
			
		}
		
		public function update(castle:CastleVO,tx:int,ty:int):void
		{
			if (castle.captainID == 0)
			{
				btMonarch.text = "";
				btCaptain.text = "";
			}
			else
			{
				//君主名
				var mid:int = (T.db.getRecord(Cnt.VO_PLAYER, castle.playerID) as PlayerVO).monarchID;
				var mName:String = (T.db.getRecord(Cnt.VO_GENERAL, mid) as GeneralVO).name;
				//太守名
				var cName:String = (T.db.getRecord(Cnt.VO_GENERAL, castle.captainID) as GeneralVO).name;
				btMonarch.text = mName;
				btCaptain.text = cName;
			}
			
			btCastle.text = castle.name;
			btRule.text = castle.rule.toString();
			
			this.x = tx;
			this.y = ty;
		}
	}

}